package sms;

import java.time.LocalDate;

public class Demo04 {
    public static void main(String[] args)throws Exception {
        //method01();
        //method02();
        StudentManagementSystem03 sms = new StudentManagementSystem03();

        //1.添加学生
        PrimaryStudent stu = new PrimaryStudent(20241316, "小新", 77, 81
                , LocalDate.parse("2013-10-12"), "233434@qq.com");
        sms.addStudent(stu);
  /*      sms.addStudent(new PrimaryStudent(20241327,"小明",90,88
                , LocalDate.parse("2014-11-12"),"233534@qq.com"));
        sms.addStudent(new PrimaryStudent(20241333,"花花",90,64
                , LocalDate.parse("2023-10-15"),"233434@qq.com"));
        sms.addStudent(new PrimaryStudent(20241335,"花花",71,83
                , LocalDate.parse("2024-12-12"),"123123323@qq.com"));*/

        sms.uploadStudentAvatar(stu,"day22-Io-01/DMR_120.jpg","day22-IO-01/src/upload");

    /*    //2.展示学生
        System.out.println("=========展示所有学生=========");
        sms.showAllStudents();

        //3.模拟使用错误编号的学生
        sms.updateStudentByIndex(10, new PrimaryStudent(20241335, "花花", 71, 83
                , LocalDate.parse("2024-12-12"), "12312@qq.com"));

        //4.展示学生
        System.out.println("=========展示所有学生=========");
        sms.showAllStudents();

        //5.模拟null引发的学生遍历问题
        sms.showAllStudents(null);

        //6.模拟解析日期出问题
        sms.getStudentsEnrolledBefore("2023/12/01");*/
    }

    private static void method02() {
        StudentManagementSystem03 sms = new StudentManagementSystem03();
        //1.添加学生
        sms.addStudent(new PrimaryStudent(20241316,"小新",77,81
                , LocalDate.parse("2013-10-12"),"233434@qq.com"));
        sms.addStudent(new PrimaryStudent(20241327,"小明",95,88
                , LocalDate.parse("2014-11-12"),"233534@qq.com"));
        sms.addStudent(new PrimaryStudent(20241333,"花花",90,64
                , LocalDate.parse("2023-10-15"),"233434@qq.com"));
        sms.addStudent(new PrimaryStudent(20241335,"天天",71,83
                , LocalDate.parse("2024-12-12"),"123123323@qq.com"));

        //2.展示学生
        System.out.println("=========展示所有学生=========");
        sms.showAllStudents();

        System.out.println("=========按照学生的总分从高到低排序=========");
        sms.sortByTotalScore();
        sms.showAllStudents();
    }

    private static void method01() {
        StudentManagementSystem03 sms = new StudentManagementSystem03();
        //1.添加学生
        sms.addStudent(new PrimaryStudent(20241316,"小新",77,81
                , LocalDate.parse("2013-10-12"),"233434@qq.com"));
        sms.addStudent(new PrimaryStudent(20241327,"小明",95,88
                , LocalDate.parse("2014-11-12"),"233534@qq.com"));
        sms.addStudent(new PrimaryStudent(20241333,"花花",90,63
                , LocalDate.parse("2023-10-15"),"233434@qq.com"));
        sms.addStudent(new PrimaryStudent(20241335,"天天",71,83
                , LocalDate.parse("2024-12-12"),"123123323@qq.com"));

        //2.展示学生
        System.out.println("=========展示所有学生=========");
        sms.showAllStudents();

        System.out.println("=========按照学生的总分从高到低排序=========");
        sms.sortByTotalScore();
        sms.showAllStudents();
    }
}

